package org.tcs.com.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.tcs.com.dao.UserDAO;
import org.tcs.com.model.User;

public class UserService {
	private UserDAO userDAO;

	/**
	 * @param userDAO
	 */
	@Autowired
	public UserService(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

	@Transactional
	public void createUser(User user) {
		userDAO.create(user);

	}
	
	@Transactional
	public void updateUser(User user){
		userDAO.update(user);
	}
	
	public User getUser(long id){
		return userDAO.fetch(id);
	}
	
	public User getUser(String userName){
		return userDAO.getUser(userName);
	}
	
}
